Audit

Set Audit Fields on Update

Description
This customization shows how to implement an audit trail by creating and modifying audit fields in a database record.
Variables
Table Name
Select the name of the database table
Audit Field
Select an audit field in the table
Applies to
RecordClass class
Code
 
''' 
''' This custom method is an event handler for the update event in the Data Access layer.
''' 
Private Sub Audit_Update(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) _
    Handles MyBase.UpdatingRecord   
	''' You can modify the following sample code to fit specific need
	   
    'Dim s As String 
    's = Trim(Me.${Audit Field} & vbCrLf & "Inserted by: " & BaseClasses.Utils.SecurityControls.GetCurrentUserName() & " on " & DateTime.Now.ToString() & ".")
    'Me.${Audit Field} = s
    
    'Update other fields
    'Me.user= "loggedInUser"    
End Sub
     

Terms of Service Privacy Statement